<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/FCKeditor.tld" prefix="fck" %>
<%@page import="java.util.*,model.*,util.*,control.*"%>
<!DOCTYPE html>
<html>
<head>
    <title>自适应测评系统</title>
    <meta charset="utf-8"/>
    <script  src='../../js/core.js'></script>
    <script  src='../../js/jquery-1.4.2.js'></script>
    <script  src='../../js/rows.js'></script>
    <link type="text/css" rel='stylesheet' href="../../css/common.css"/>
    <link type="text/css" rel='stylesheet' href="../../css/houtai.css"/>
</head>
           <%
           /***********************************************************************************/
           /*
           *验证权限
           *author 胡瑾
           *data 2011-12-08
           */
			String flag = (String)session.getAttribute("flag");
			String userId = (String)session.getAttribute("userId");
			int adminId = Integer.parseInt(userId);
						
			if (flag != "admin"|| flag == null )
			{
				%>
      <script language="javascript">
				     alert("您没有管理员权限,请重新登录"); window.location.href="../../index.jsp";
				    </script>
      <%
				
			}else{
				Admin admin = new Admin();
				AdminControl ac = new AdminControl();
				admin = ac.GetAdmin(adminId);
				//out.print("<p>"+admin.getName()+"   欢迎您</p>");
				
			}
			/*********************************************************************************/
           %>
<body>
<form method="post">
	<table width='1000' class='main'>
  	<thead>
        <tr>
          <td width='100'>序号</td>
          <td width='100'>id</td>
          <td width='100'>用户名</td>
          <td width='100'>姓名</td>
          <td width='100'>密码</td>
          <td width='100'>性别</td>
          <td width='200'>学校</td>
          <td width='100'>班级</td>
          <td width='200'>专业</td>
          <td width='100'>操作</td>
        </tr>
        </thead>
        <%
		int k = 0;
		request.setCharacterEncoding("utf-8");
		Student student = new Student();
		StudentControl sc = new StudentControl();
		int pages = ParamUtil.getInt(request,"pages",1);
		int rowsPerPage = ParamUtil.getInt(request,"pageSize",20);
		
		List<Student>list = new ArrayList<Student>();
		list = (List)sc.GetStudent(pages,rowsPerPage);
		for(int i = 0; i<list.size();i++)
		{
			student = list.get(i);
			k++;
			//student.setStudentId(k);
			 //student.studentId = k;
	%><tbody>
        <tr>
          <td><%=k %></td>
          <td><%=student.getStudentId()%></td>
          <td><%=student.getUsername() %></td>
          <td><%=student.getStudentName() %></td>
          <td><%=student.getPassword() %></td>
          <td><%=student.getSex() %></td>
          <td><%=student.getSchool() %></td>
          <td><%=student.getClasses() %></td>
          <td><%=student.getMajor() %></td>
          <td><a href="student_update.jsp?id=<%=student.getStudentId()%>">修改</a> | 
          <a href="student_del.jsp?id=<%=student.getStudentId()%>">删除</a></td>
        </tr>
        <%
	    } 
	    %>
	    </tbody>
      </table>
        <p style='margin-left: 20px;'><%
		out.println(StudentControl.pageInstance.getToolsMenu(pages));
		%></p>
    </form>
 </body>
</html>
